/*
 * *
 * author:cgm
 * date:18-5-16 下午3:39
 * /
 */

package com.kaili.common.checkField;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * package name:com.kaili.common.checkField
 * author:hasee
 * date :2018/5/16
 * project:micro-service
 */
public class PhoneFeildCheck implements CheckFieldHandler {
    private static final String PhoneRegExp = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";

    @Override
    public boolean checkField(Object obj) {
        String phone = (String) obj;
        Pattern pattern = Pattern.compile(PhoneRegExp);
        Matcher matcher = pattern.matcher(phone);
        return matcher.matches();
    }
}
